home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1993-11-04 | 2.4 KB | 64 lines |
- (* Errors General module to store error messages Moe 21.03.84
- ====== ======================================
- This module stores information about syntax errors and semantic errors.
- The information can either be retrieved afterwards or be printed
- automatically as simple error messages.
- Furthermore the module contains procedures to report compiler errors
- and implementation restrictions. These procedures cause a program stop.
- ----------------------------------------------------------------------*)
- DEFINITION MODULE Errors;
-
- FROM FileSystem IMPORT File;
-
- (*EXPORT QUALIFIED
- CompErr, Errorptr, GetNextSemErr, GetNextSynErr, GetNumberOfErrors,
- PrintSemErrors, PrintSynErrors, Restriction, SemErr, SyntaxError;*)
-
- TYPE
- Symbolname = ARRAY[1..25] OF CHAR;
- Errorptr = POINTER TO Errornode;
- Errornode = RECORD (*expected symbol in syntax error message*)
- txt: Symbolname;
- l: CARDINAL;
- next: Errorptr;
- END;
-
-
- PROCEDURE CompErr(nr:CARDINAL);
- (* Reports compiler error nr and stops the program*)
-
- PROCEDURE GetNextSemErr(VAR nr,line,col:CARDINAL);
- (* Gets the error number, the line number and the column number of the
- next semantic error. nr=0 if no next error exists*)
-
- PROCEDURE GetNextSynErr(VAR symbols:Errorptr; VAR line,col:CARDINAL);
- (* Gets the expected symbols, the line number and the column number of
- the next syntax error. symbols=NIL if no next error exists*)
-
- PROCEDURE GetNumberOfErrors(VAR synerrors,semerrors:CARDINAL);
- (* Gets the total number of syntax errors and semantic errors which
- occured during compilation*)
-
- PROCEDURE PrintSemErrors(VAR f:File; VAR semerrors:CARDINAL);
- (* Prints error messages for all stored semantic errors (line,col,
- error number). semerrors holds the total number of stored semantic
- errors*)
-
- PROCEDURE PrintSynErrors(VAR f:File; VAR synerrors:CARDINAL);
- (* Prints error messages for all stored syntax errors (line,col,
- "near symbol",expected symbols). synerrors holds the total number of
- stored syntax errors*)
-
- PROCEDURE Restriction(nr:CARDINAL);
- (* Reports implementation restriction nr and stops the program*)
-
- PROCEDURE SemErr(nr,line,col:CARDINAL);
- (* Stores the error number, line number and column number of a semantic
- error*)
-
- PROCEDURE SyntaxError(symbols:Errorptr; line,col:CARDINAL);
- (* Stores the "near-symbol", the expected symbols, the line number and
- the column number of a syntax error*)
-
- END Errors.
-